package com.java.string.String;

/**
 * String创建对象：直接赋值和构造函数赋值
 */
public class Create {
    public static void main(String[] args) {
        // 直接赋值
        String str1 = "abc";
        String str2 = "ABC";
        String str3 = "abc";
        System.out.println(str1 == str2); // false
        System.out.println(str1 == str3); // true
        
        // 构造函数赋值
        String str4 = new String("abc");
        String str5 = new String("abc");
        System.out.println(str4 == str5); // false
    }
}
